package com.szholly.data.general;

/**
 * 类功能说明 表关联强度
 */
public enum RelationStrength {

	/**
	 * 视图查询
	 */
	OnlySelect(0),

	/**
	 * 外键更新 查询时关联，如果主表更新了主键，同时更新相关主键
	 */
	UpdateRelation(1),

	/**
	 * 主子表联动
	 */
	UpdateChild(2);

	private final int relationStrength;

	public int getRelationStrength() {
		return relationStrength;
	}

	private RelationStrength(int relationStrength) {
		this.relationStrength = relationStrength;
	}

	// 通过tableTypeID返回 TableType
	public static RelationStrength getTableTypeByTypeId(int relationStrengthId) {
		for (RelationStrength relationStrength : values()) {
			if (relationStrength.getRelationStrength() == relationStrengthId) {
				return relationStrength;
			}
		}
		return null;
	}

	public static void main(String[] args) {
		System.out.println(RelationStrength.values());
	}

}